package com.ay.weixin.fdc.boss.share.db;

import java.sql.SQLException;
import java.util.List;

import lizar.db.ibatis.Dao;

import com.ay.weixin.fdc.boss.share.domain.ShareActivityContent;

public class ShareActivityContentDao extends Dao {

	public void insert(ShareActivityContent content) throws SQLException{
		this.sqlMapper.insert("share_activity_content.insert",content);
	}
	
	public ShareActivityContent getById(long id) throws SQLException{
		return (ShareActivityContent)this.sqlMapper.queryForObject("share_activity_content.getById",id);
	}
	
	public void update(ShareActivityContent content) throws SQLException{
		this.sqlMapper.insert("share_activity_content.update",content);
	}
	
	public int getMaxPos(long sa_id) throws SQLException{
		Integer max=(Integer)this.sqlMapper.queryForObject("share_activity_content.getMaxPos",sa_id);
		if(max==null){
			return 0;
		}
		return max+1;
	}
	
	public void deleteBySaId(long sa_id) throws SQLException{
		this.sqlMapper.delete("share_activity_content.deleteBySaId",sa_id);
	}
	
	public void delete(long id) throws SQLException{
		this.sqlMapper.delete("share_activity_content.delete",id);
	}
	
	public List<ShareActivityContent> getBySAId(long sa_id) throws SQLException{
		return (List<ShareActivityContent>)this.sqlMapper.queryForList("share_activity_content.getBySAId",sa_id);
	}
	
}
